/*
 * BBActionEnd.java
 *
 * Created on March 21, 2008, 10:54 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package hextd.blackBox;

import hextd.util.Context;

/**
 *
 * @author hylke
 */
public class BBActionEnd implements BBAction {
    
    private static final BlackBox.ActionType type = BlackBox.ActionType.End;
    private int     gameTime;
    
    /** Creates a new instance of BBActionEnd */
    public BBActionEnd(int gameTime) {
        this.gameTime = gameTime;
    }

    @Override
    public BlackBox.ActionType getType() {
        return BBActionEnd.type;
    }
    
    @Override
    public int getGameTime() {
        return this.gameTime;
    }
    
    @Override
    public void execute(Context c) {
        //System.out.println("BBActionEnd::execute: "+c.gameTime+" Ending replay");
        if (!c.blackBoxCurrent.endGame()) {
            System.err.println("BBActionEnd::execute: Sync error: Ending replay failed!");
        }
    }
    
    @Override
    public String getString() {
        return ""+this.gameTime+" E\n";
    }
}
